package com.hlhj.carview.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.hlhj.carview.Iview.GainView
import com.hlhj.carview.bean.GainDetailBean
import com.hlhj.carview.http.Apis
import com.hlhj.carview.http.CustomAction
import com.hlhj.carview.http.LoadingAction
import com.lzy.okgo.model.Response

/**
 * Created by Never Fear   on 2018\12\20 0020.
Never More....
 */
class GainModule :BaseModule {
    var lis:GainView?=null
    fun getGain(page:Int,c:Context){
        Apis?.getGainDetail(page)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<GainDetailBean>>(c){
                                override fun httpSuccess(t: Response<GainDetailBean>) {
                                    lis?.setGain(t.body())
                                }
                            })
                }
    }
}